package com.qf.czh.vhr.Service;

import com.qf.czh.vhr.Mapper.MenuMapper;
import com.qf.czh.vhr.entity.Hr;
import com.qf.czh.vhr.entity.Menu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuService {
    @Autowired
    MenuMapper menuMapper;
    public List<Menu> getMenuByCurrentHrId() {
        Hr principal = (Hr) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        Integer id = principal.getId();

        List<Menu> list = menuMapper.getMenuByCurrentHrId(id);
        return list;

    }

    public List<Menu> getAllMenus() {
        return menuMapper.getAllMenus();
    }
}
